/*
 * @Date: 2022-12-06 02:08:27
 * @Autor: lx
 * @LastEditors: lipengxi 2899952565@qq.com
 * @LastEditTime: 2022-12-08 23:41:46
 * @FilePath: /vdom-snabbdom/src/demo3.js
 */
import { init } from "snabbdom/build/package/init";
import { h } from "snabbdom/build/package/h";
import { styleModule } from "snabbdom/build/package/modules/style";
import { eventListenersModule } from "snabbdom/build/package/modules/eventlisteners";

// 注册模块
const patch = init([styleModule, eventListenersModule])

const eventHandler = () => { console.log("click") }

let vnode = h("div", [
    h("h1", { style: { background: "red" } }, "hello lx"),
    h("p", { on: { click: eventHandler } }, "hello p")
])
const app = document.querySelector("#app")

patch(app, vnode)